package com.zch.rpc.client.config;

import com.zch.rpc.core.invoke.SpringRpcInvokerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther: zch
 * @Date: 2019/1/9 14:54
 * @Description:
 */
@Configuration
public class RpcInvokerConfig {
    @Value("${rpc.server.address}")
    private String serverIpPort;
    @Value("${rpc.protocol}")
    private String protocol;
    @Bean
    public SpringRpcInvokerFactory initSpringRpcInvokerFactory(){
        SpringRpcInvokerFactory springRpcInvokerFactory=new SpringRpcInvokerFactory();
        springRpcInvokerFactory.setIpPort(serverIpPort);
        springRpcInvokerFactory.setProtocol(protocol);
        return springRpcInvokerFactory;
    }
}
